home *** CD-ROM | disk | FTP | other *** search
- /* $VER: VersionCopy.DOpus V1.0 (30-Jun-96) Allan Odgaard
- Please send an email to <Duff@DIKU.DK> if you use it.
- Also check out <http://www.DIKU.dk/students/duff/>
-
- Intro:
- ¯¯¯¯¯¯
- This script works with DOpus 4.x, its purpose is to show versioninfo for the
- selected file and the one with the same name in the destination lister. And
- based upon this, the user can select wether (s)he wants to replace the
- file or not.
-
- When you choose to replace a file, then this script will make sure that the
- comment and name of the old file are intact. This means that if your
- diskfontlib is named DiskFont.Library and commented to "Workbench 3.1", then
- if you copy in a new diskfont.library which is strictly in lower case and has
- no comment, the this new file will inherit the olds comment and case usage.
-
- Install:
- ¯¯¯¯¯¯¯¯
- Action: DoubleClick or Click-m-click.
- AmigaDOS: Rexx:DirectoryOpus/VersionCopy.DOpus {o} {Qp}
- \ Run asynchronously
-
- Action: Button, Menu or Hotkey.
- ARexx: Rexx:DirectoryOpus/VersionCopy.DOpus
-
- */
-
- Options Results
-
- Parse Arg '"' File '"' PortName .
- If PortName ~= '' Then Address(PortName)
-
- /* Trace Results */
-
- LF = '0a'x
-
- Status 3 ; ActWin = Result
- Status 13 ActWin ; SrcDir = Result
- Status 13 1-ActWin ; DestDir = Result
- Status 27 ; OldCancel = Result
- Status 27 Set "Skip"
-
- Busy On
-
- If File = '' Then Signal ProgramStart
- Call HandleFile
-
- End: Status 27 Set OldCancel
- Address Command "C:Delete T:Version.#? Quiet"
- Busy Off
- ReScan 1-ActWin
- Exit
-
- ProgramStart: GetNextSelected ; File = Result
- If File="0" Then Signal End
- Call HandleFile
- Signal ProgramStart
-
- HandleFile: SelectFile File 0 1
- If ~Exists(DestDir || File) Then Do ; Copy File ; Return ; End
-
- Address Command 'C:VersionWB "'SrcDir || File'" Text >T:Version.Tmp'
- Call ExtractVer ; NewFile = Result
-
- Address Command 'C:VersionWB "'DestDir || File'" Text >T:Version.Tmp'
- Call ExtractVer ; OldFile = Result
-
- AskUser: Request "`"File"'"LF || LF"New files version:" NewFile || LF || "Old files version:" OldFile || LF || LF"Would you like to replace the file?"
- If Result=0 Then Return
- Address Command 'C:FileNote "'SrcDir || File'" "`C:List "'DestDir || File'" LFormat %c`"'
- Address Command 'C:Copy >T:Version.Copy "'SrcDir || File'" "'DestDir'`C:List "'DestDir'" Pat="('File'|%)" LFormat %n`" Clone'
- If RC ~= 0 Then Do
- Open('Error','T:Version.Copy','Read') ; Request ReadLn('Error') ; Close('Error')
- End
- Return
-
- ExtractVer: Open('VerOut','T:Version.Tmp','Read')
- SearchLoop: If EOF('VerOut') Then Do
- Close('VerOut')
- Return('Unknown')
- End
- VerTmp = ReadLn('VerOut')
- If Left(VerTmp,9) ~= "Version: " Then Signal SearchLoop
- FoundVer: Version = Right(VerTmp,Length(VerTmp)-9)
- Close('VerOut')
- Return(Version)
-